package com.rem.springIocAnnotation.entity;

/**
 * @author Rem
 * @date 2023-02-28
 */
public class User {

    private Integer id;

    private String username;

    public User() {
        System.out.println("生命周期：1、创建对象");
    }

    public User(Integer id, String username) {
        this.id = id;
        this.username = username;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        System.out.println("生命周期：2、依赖注入");
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void initMethod(){
        System.out.println("生命周期：3、对象初始化");
    }

    public void destroyMethod(){
        System.out.println("生命周期：5、销毁");
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                '}';
    }
}
